//
//  AskingTableViewCell.m
//  TodatPlay
//
//  Created by dllo on 16/9/6.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "AskingTableViewCell.h"
#import "SDAutoLayout.h"
#import "AskingDatalist.h"
@implementation AskingTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createContens];
    }
    return self;
}


- (void)createContens {
    self.avatarImg = [UIImageView new];
    self.timeLabel = [UILabel new];
    self.contentsLabel = [UILabel new];
    self.userNameLabel = [UILabel new];
    UIView *backView = [UIView new];
    [backView addSubview:_avatarImg];
    [backView addSubview:_timeLabel];
    [backView addSubview:_contentsLabel];
    [backView addSubview:_userNameLabel];
    [self.contentView addSubview:backView];
    
    
    backView.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.contentView, 0)
    .rightSpaceToView(self.contentView, 10)
    .autoHeightRatio(0);
    backView.backgroundColor =[UIColor whiteColor];
    
    self.avatarImg.sd_layout
    .leftSpaceToView(backView, 10)
    .topSpaceToView(backView, 10)
    .widthIs(30)
    .heightIs(30);
    self.avatarImg.layer.cornerRadius = 15;
    self.avatarImg.layer.masksToBounds = YES;
    self.avatarImg.image = [UIImage imageNamed:@"login_yonghu_boy"];
    
    self.userNameLabel.sd_layout
    .leftSpaceToView(self.avatarImg, 5)
    .centerYEqualToView(self.avatarImg).offset(-5)
    .rightSpaceToView(backView, 5)
    .autoHeightRatio(0);
    self.userNameLabel.font = [UIFont systemFontOfSize:15];
    
    
    self.timeLabel.sd_layout
    .leftSpaceToView(self.avatarImg, 5)
    .topSpaceToView(self.userNameLabel, 5)
    .rightSpaceToView(backView, 5)
    .autoHeightRatio(0);
    self.timeLabel.font = [UIFont systemFontOfSize:12];
    self.timeLabel.textColor = [UIColor colorWithWhite:0.702 alpha:1.000];
    
    self.contentsLabel.sd_layout
    .leftSpaceToView(self.avatarImg, 5)
    .rightSpaceToView(backView, 20)
    .topSpaceToView(self.timeLabel, 8)
    .autoHeightRatio(0);
    self.contentsLabel.textColor = [UIColor colorWithWhite:0.298 alpha:1.000];
    self.contentsLabel.font = [UIFont systemFontOfSize:15];
    
    [backView setupAutoHeightWithBottomView:self.contentsLabel bottomMargin:15];
    [self setupAutoHeightWithBottomView:backView bottomMargin:10];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
